<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/home/css/style.css"/>
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/home/css/reset.css"/>
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/home/css/media.css"/>

		<title></title>
		<link rel="stylesheet" href="__PUBLIC__/home/css/qqFace.css">
        <style type="text/css">
.background1 {position:fixed;width: 100%;height: 100%; z-index:1040; top:0;left:0; background:rgb(50,50,50); background:rgba(0,0,0,0.5);  }
#content7{width:60%;height:60%;top:18%;left:22%;position:absolute;box-sizing: border-box ;border-radius: 3px; z-index:1050; overflow:hidden;zoom:1; text-align: center}
.content7-box{width: 80%;height: 80%;margin: 0 auto;background-color: #FFFFFF;text-align: center;}
.content7-p::-webkit-scrollbar { width:4px; height: 4px; }
.content7-p::-webkit-scrollbar-thumb {border-radius:10px;-webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.5);background: rgba(0,0,0,0.5);}
.content7-p::-webkit-scrollbar-track {-webkit-box-shadow:inset 0 0 5px rgba(0,0,0,0.2);border-radius: 0; background: rgba(0,0,0,0.1);}
.content7-box h4{height: 35px;line-height: 35px;}
.content7-box p{font-size:14px;color: #333333;}
.content7-p{text-align: left;width:90%;height: 90%; margin:0 auto;overflow:auto;}
.icon-del7{margin-left: 75%;}
.foot_sp1{cursor: pointer;}
        </style>
	</head>
	<body>
		<div class="wrapper">
			<!--头部-->
			{include file="public:head" /}
			<div class="content">
				<!--直播预告-->
				{include file="public:live" /}
				<div class="overflow">
					<!--视频直播-->
					{include file="public:movie" /}
					<div class="con_right dis_in">
						<div class="chat_box" >
							<ul class="chat_nav">
									<li id="hd_li"><span class="ok cursor"  id="hd">互动聊天</span></li>
									<li id="wz_li"><span class="no cursor"  id="wz">文字同步直播</span></li>
							</ul>
						   <div class="chat_con_box1" id="chat_box1" style="display:block;" >
								<div class="chat_b1">
									<div class="messageBox">
										<div id="message">

										</div>
									</div>
									<div class="chat_btm_bg">
										<img src="__PUBLIC__/home/images/icon_bl.png"/>
									</div>
								</div>
								<div class="function_bar">
										<div class="fun_box">
											<ul>
												<li><span class="clear" title="清空"><img src="__PUBLIC__/home/images/icon_delete.png"/></span></li>
												<li><span class="emotion" title="表情"><img src="__PUBLIC__/home/images/icon_face.png"/></span></li>
												<li style="position: relative"><span><img src="__PUBLIC__/home/images/icon_pic.png"/></span><input type="file" id="fileId" value="UploadImage" name="image" /></li>
											</ul>
											<a href="tencent://message/?uin=2881591276&Menu=yes" class="qq_box">
												<img src="__PUBLIC__/home/images/icon_qq.png"/>
												<span>QQ交谈</span>
											</a>
										</div>
										<div class="inp_box">
											<div class="inp_inp dis_b" id="content" contenteditable="true"></div>
											<input class="inp_inp1" type="button" name="" id="sendMessage" value="发送" />
		
										</div>
								</div>
						   </div>
						   <div class="chat_con_box2" id="chat_box2" style="display:none;">
	                         	<div class="chat_b2">
									<div class="messageLiveBox">
										<div id="messageLive"></div>
									</div>
	                         	</div>
                        	</div>
						</div>
						<div id="fly_notice" style="width: 100%;font-size: 14px;color:#000;position: absolute;top:10%;right:-30%;" class="fly_notice">
							<div class="remind" style="position: absolute;left: 70%;">
								<img class="icon_fly" src="__PUBLIC__/home/images/icon_fly.png"/>
								<span class="re_sp">提醒刚进来的游客朋友</span>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="footer">
				<span class="foot_sp">投资有风险，入市需谨慎</span>
				<span class="foot_sp1">免责声明</span>
			</div>
		</div>
		{include file="public:window" /}
		<div class="popup hide1" id="popup">

		</div>
       <div class="background1 hide1" ></div>
		<div id="content7" class="hide1">
			<img class="icon-del7" src="__PUBLIC__/home/images/icon_delete1.png"/>
			<div class="content7-box">
				<h4>免责声明</h4>
				<div class="content7-p">
					<p>投资有风险，入市需谨慎，在您观看牛股解码直播的同时，请您知悉以下内容：</p>	
					<p>1、牛股解码已采取谨慎的措施对信息进行核实，但并不保证所含信息全部准确。请您理解我们的信息可能会不全面，或有疏漏或滞后。</p>
					<p>2、牛股解码平台及主播发布的内容均不应作为您投资的依据，您的任何投资决策均须独立作出，风险自担。请您确认自己具有相应行使权利的能力和做出行为的能力，并且能够独立承担法律责任。无论付费课程或公开课，都不能确保您获得盈利或本金不受损失。</p>
					<p>3、牛股解码和第三方内容提供商对用户提供的所有数据和信息仅供参考，刊载这些文档并不构成对任何股份的收购、购买、认购、抛售或持有的邀约或意图。参阅本网站上所刊的文档的人士，应被视为已确认得悉上述立场。投资者依据本网站提供的信息、资料及图表进行金融、证券等投资项目所造成的盈亏与本网站无关。</p>
					<p>4、用户应当妥善保管个人的帐号和密码，由于用户泄漏帐号和密码或者将个人密码告知他人、与他人共享注册帐户，由此造成的损失与本网站无关，由用户个人承担。</p>
					<p>5、任何由于黑客攻击、计算机病毒侵入或发作，因政府管制而造成的暂时性关闭等影响网络正常经营的不可抗力而造成的个人资料泄露、丢失、被盗用或被窜改等，本网站及时采取补救措施后，本网站均得免责。</p>
					<p>6、本网站如因系统维护或升级而需暂停服务，或因线路及非本公司控制范围外的硬件故障或其它不可抗力而导致暂停服务，于暂停服务期间造成的一切不便与损失，本网站不负任何责任。</p>
					<p>7、本网站禁止制作、复制、发布、传播等具有反动、色情、暴力、淫秽等内容的信息，一经发现，立即删除。若您因此触犯法律，我们对此不承担任何法律责任。</p>
					<p>8、本网站发现法律、法规禁止发布或者传输的信息的，将立即停止传输该信息，采取消除等处置措施，保存有关记录，并有权向有关主管部门报告，除此之外，本网站使用者因为违反本声明的规定而触犯中华人民共和国法律的，一切后果自己负责，本网站不承担任何责任。</p>
					<p>9、凡以任何方式登陆本网站或直接、间接使用本网站资料者，视为自愿接受本网站声明的约束。</p>
				    <p>10、本声明未涉及的问题参见国家有关法律法规，当本声明与国家法律法规冲突时，以国家法律法规为准。任何单位或个人认为本站的内容可能涉嫌侵犯其合法权益，应该及时联系本网站进行反馈，并提供身份证明、权属证明及详细侵权情况证明。本网站在收到上述法律文件后，将会尽快处理被控侵权内容。</p>
				    <p>11、牛股解码平台不对内容的准确性、真实性、有效性、原创性负责。主播发布的内容（包括但不限于课程、问答、观点等）所涉及的任何投资品种以及任何操作仅代表其个人观点，不代表平台的观点，仅限于用户间交流和探讨，不构成投资建议，不具有证券投资咨询信息性质，不构成对任何股票、债券或任何其它任何金融产品的购买邀请，不应成为您作出任何投资或其他决定的依据。如果您依据平台或主播发布的任何内容进行操作，风险由您自行承担，平台和主播对您可能遭受的损失不承担任何责任。</p>
				    <p>12、若您对主播课程或内容不满意，或您发现主播出现发布违规信息、广告信息、线下揽客等违反平台服务规范的行为，请与平台联系，平台将及时处理。为保障您的权益，请您不要通过其他平台或者线下接受主播的服务，也不要接受主播提供的非本平台约定的服务，否则由此造成的风险和损失由您自行承担，与平台无关，平台对此不承担任何责任。</p>
				    <p>13、本网站之声明以及其修改权、更新权及最终解释权均属深圳国诚投资咨询有限公司上海分公司所有。</p>
				</div>
			</div>
		</div>		
		

	</body>
	<script src="__PUBLIC__/home/js/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="__PUBLIC__/home/js/jquery.qqFace.js"></script>
	<script type="text/javascript" src="__PUBLIC__/home/js/jquery-browser.js"></script>
	<script type="text/javascript" src="__PUBLIC__/home/js/jquery.cookie.js"></script>
	<script type="text/javascript" src="__PUBLIC__/home/js/base.js"></script>
	<script type="text/javascript" src="__PUBLIC__/home/js/user.js"></script>
	<script type="text/javascript" src="__PUBLIC__/home/js/chart.js"></script>
	<script src="__PUBLIC__/home/js/ajaxfileupload.js" type="text/javascript"></script>
	<script>
		$('.foot_sp1').click(function(){
			$('.background1').show();$('#content7').show();
		});
		$('.icon-del7').click(function(){
			$('.background1').hide();$('#content7').hide();
		});
		var _hv678videoarea = "videoarea";
		var _hv678usercode = "";
		var _hv678username = "";
		(function() {
			var hp = document.createElement("script");
			hp.src = "http://jsjr.hv678.com/room/script/playerchat/9621d2d944c34ac6ba9a8501c1ebc3e6"
			var s = document.getElementsByTagName("script")[0];
			s.parentNode.insertBefore(hp, s);
		})();
	</script>

	<script>
		//qq表情
		$(function(){
			$('.emotion').qqFace({
				assign:'content',
				path:'__PUBLIC__/home/face/'	//表情存放的路径
			});

			$(".clear").click(function () {
				$("#message").empty();
			});
			$("#userLogin").click(function () {
				$(".userLogin").show();
			});
			$("#register").on("click", function () {
				$(".userRegister").show();
			});
			$(".forget").on("click", function () {
				$(".forgetPassword").show();
				$(".userLogin").hide();
			});

			if ($.cookie("rmbUser") == "true") {
				$("#ck_rmbUser").prop("checked", true);
				$("#username").val($.cookie("username"));
				$("#password").remove();
				$("#pass").append("<input id='password' type='password' class='txt2'/>");
				$("#password").val($.cookie("password"));
			}
			//下一步
			var nextMobile="";
			$(".next").on("click", function () {
				nextMobile=$(".forgetPassword .mobile").val();
				var code=$(".forgetPassword .code").val();
				$.ajax({
					type:"POST",
					url:"http://zbstest.guochengic.com/home/user/forgetPassword",
					data:{
						"username":nextMobile,
						"code":code
					},
					success: function (res) {
						if(res.code==0){
							$(".forgetPassword2").show();
							$(".forgetPassword").hide();
						}else {
							$("#error").show();
							$("#errmsg").html(res.msg);
							errorHide();
							return;
						}
					}
				});
			});
//保存
			$(".save").on("click", function () {
				var password1=$(".forgetPassword2 .password1").val();
				var password2=$(".forgetPassword2 .password2").val();
				var username=nextMobile;
				$.ajax({
					type:"POST",
					url:"http://zbstest.guochengic.com/home/user/forgetPwdNext",
					data:{
						"password":password1,
						"repassword":password2,
						"username":username
					},
					success: function (res) {
						if(res.code==0){
							$(".forgetPassword2").hide();
							$('#sucmsg').html(res.msg);
							$("#suc").show();
							successHide();
							return;
						}else {
							$("#error").show();
							$("#errmsg").html(res.msg);
							errorHide();
							return;
						}
					}
				});
			});
			//获取聊天记录&quot
			$.ajax({
				url:"http://zbstest.guochengic.com/home/Chat/getChat",
				type:"POST",
				success: function (res) {
					console.log(res)
					if(res.code==0){
						var html="";
						for(var i =(res.data.is_verify.length-1);i>=0;i--){
							var messageData=res.data.is_verify[i];
							var message=JSON.parse(messageData.content);
							var uid=$("#userId").attr("data-id");
							var imgSrc=src(message.identity);
							if(messageData.status==1){
								if(message.uid!=uid){
									html += '<div class="chat_con" data-id="'+messageData.id+'">' +
											'<p class="chat_p">' +
											'<img class="icon_zl" src='+imgSrc+'>' +
											'<span class="uid zl_name" data-id="'+message.uid+'" onclick="reply(this)">'+message.nickname+'</span>' +
											'<span class="sendTime">'+message.sendTime+'</span>' +
											'</p>' ;
									if(message.identity==2){
										html+='<span class="zl_con dis_in">'+message.content+'</span></div>';
									}else {
										html+='<span class="yk_con  dis_in">'+message.content+'</span></div>';
									};
								}else {
									html += '<div class="chat_con chat_right" data-id="'+messageData.id+'">' +
											'<p class="chat_p">' +
											'<img class="icon_zl" src='+imgSrc+'>' +
											'<span class="uid zl_name" data-id="'+message.uid+'" onclick="reply(this)">'+message.nickname+'</span>' +
											'<span class="sendTime">'+message.sendTime+'</span>' +
											'</p>';
									if(message.identity==1){
										html+='<span class="zl_con dis_in">'+message.content+'</span></div>';
									}else {
										html+='<span class="yk_con  dis_in">'+message.content+'</span></div>';
									};
								}
							};
						}

						$("#message").append(html);
						var _height=$('#message')[0].scrollHeight;
						$(".messageBox").animate({scrollTop:_height+'px'},500);
					}
				}
			});

			$("#wz_li").click(function () {
				var html="";
				$.ajax({
					url:"http://zbstest.guochengic.com/home/chat/getTextChat",
					type:"POST",
					success: function (res) {
						console.log(res)
						if(res.code==0){
							for (var i=0;i<res.data.length;i++){
								var messageData=res.data[i];
								var message=JSON.parse(messageData.content);
								var uid=$("#userId").attr("data-id");
								var imgSrc=src(message.identity);
								html += '<div class="chat_con">' +
										'<p class="chat_p">' +
										'<img class="icon_zl" src='+imgSrc+'>' +
										'<span class="uid zl_name" data-id="'+message.uid+'" onclick="reply(this)">'+message.nickname+'</span>' +
										'<span class="sendTime">'+message.sendTime+'</span>' +
										'</p>'+
								        '<span class="zl_con dis_in">'+message.content+'</span></div>';
							}
							$("#messageLive").html(html);
							var _height=$('#messageLive')[0].scrollHeight;
							$(".messageLiveBox").animate({scrollTop:_height+'px'},500);
						}
					}
				})
			});

		});
		//查看结果
		function replace_em(str){
			str = str.replace(/\</g,'&lt;');
			str = str.replace(/\>/g,'&gt;');
			str = str.replace(/\n/g,'<br/>');
			str = str.replace(/\[em_([0-9]*)\]/g,'<img src="__PUBLIC__/home/face/$1.gif" border="0" />');
			return str;
		}
		//表情结束


		$(".nav_ul").on("click","li",function () {
			var type=$(this).attr("data-type");
			var id=$(this).attr("data-id");
			if($(this).hasClass("mr_ng")){
				var is_login = "<?php echo checkLogin()?>";
				if(is_login){
					$.ajax({
						url:"<?php echo url('index/typeData')?>",
						type:"POST",
						data:{
							"type":type,
							"column_id":id
						},
						success: function (data) {
							$("#popup").html(data);
							$("#popup").show();
						}
					});
				}else {
					$("#errmsg").html("请先登录！");
					$("#error").show();
					errorHide();
					return;
				}
			}else {
				$.ajax({
					url:"<?php echo url('index/typeData')?>",
					type:"POST",
					data:{
						"type":type,
						"column_id":id
					},
					success: function (data) {
						$("#popup").html(data);
						console.log(data);
						$("#popup").show();
					}
				});
			}
		});
		//核心内参列表点击事件
		function article(id,thisli){
			var article_id=id;
			$(".sp12.select").removeClass("select");
			$(thisli).find(".sp12").addClass("select");
			$(this).addClass(".sp12").addClass("select");
			$.ajax({
				url:"http://zbstest.guochengic.com/home/index/getCoreOne",
				type:"POST",
				data:{
					"article_id":article_id
				},
				success: function (res) {
					if(res.code==0){
						var title=res.data.title;
						var attachment=res.data.attachment;
						var attachment_path=res.data.attachment_path;
						var create_time=res.data.create_time;
						var page_view=res.data.page_view;
						var author=res.data.author;
						var summary=escape2Html(res.data.summary);
						$("#content2 .box_r_con h4").html(title);
						$("#content2 .box_r_con .time").html(create_time);
						$("#content2 .box_r_con .author").html(author);
						$("#content2 .box_r_con .pp1").html(summary);
						$("#content2 .box_r_con .in_btn1").attr("href",attachment_path);
					}else {
						$("#errmsg").html(res.msg);
						$("#err").show();
						errorHide();
						return;
					}
				}
			});
		};

		//获取验证码
		var clock = '';
		var times = 60;
		var btn;
		function sendCode(thisBtn,type) {
			if($(thisBtn).html()!="获取验证码"){return false;}
			clearInterval(clock);
			times=60;
			var mobile = $("."+type+"Mobile").val();
			var    reg = /^1[0-9]{10}/;
			if(mobile == ''){
				$('#errmsg').html('手机号不能为空');
				$('#error').show();
				errorHide();
				return;
			}else if(!reg.test(mobile) && mobile.length!=""){
				$('#errmsg').html('手机号码格式不正确');
				$('#error').show();
				errorHide();
				return;
			}
			$.ajax({
				type:'post',
				url:"http://zbstest.guochengic.com/home/code/sendCode",
				data:{'username':mobile,'action':type},
				success:function(msg){
					console.log(msg)
					if(msg.code==0){
						$('#sucmsg').html('发送成功');
						$("#suc").show();
						successHide();
						btn = $(thisBtn)[0];
						btn.disabled = true; //将按钮置为不可点击
						btn.innerHTML  = times + '秒后获取';
						clock = setInterval(doLoop, 1000); //一秒执行一次
					}else{
						$("#error").show();
						$("#errmsg").html(msg.msg);
						errorHide();
						return;
					}
				}
			});

		};
		function doLoop() {
				times--;
				if(times > 0){
					btn.innerHTML = times+'秒后获取';
				}else{
					clearInterval(clock); //清除js定时器
					btn.disabled = false;
					btn.innerHTML = '获取验证码';
					times = 60; //重置时间
				}
			};
		//短信验证码结束
		//记住用户名密码
		function save() {
			if ($(".cursor input").prop("checked")) {
				var username = $(".userLogin .mobile").val();
				var password = $(".userLogin .password").val();
				$.cookie("rmbUser", "true", { expires: 7 }); //存储一个带7天期限的cookie
				$.cookie("username", username, { expires: 7 });
				$.cookie("password", password, { expires: 7 });
			}else{
				$.cookie("rmbUser", "false", { expire: -1 });
				$.cookie("username", "", { expires: -1 });
				$.cookie("password", "", { expires: -1 });
			}
		};
		//用户退出
		function userLeave(){
			if(confirm("确认退出么？")){
				$.ajax({
					type:"POST",
					url:"<?php echo url('home/User/dropOut')?>",
					success: function (res) {
						if(res.code==0){
							$("#suc").show();
							$("#sucmsg").html(res.msg);
							successHide();
							location.reload();
							return;
						}else {
							$("#error").show();
							$("#errmsg").html(res.msg);
							errorHide();
							return;
						}
					}
				});
			}
		}

//		聊天开始
		ws = new WebSocket("ws://139.196.38.101:2346");
		ws.onopen = function() {
			console.log('连接成功');
		}
		//主要接受管理员推送的审核通过的数据
		ws.onmessage = function(e) {
			var message=JSON.parse(e.data);
			var uid=$("#userId").attr("data-id");
			var imgSrc=src(message.identity);
			console.log();
			if(message.status==1){
				if(message.uid!=uid){
					var html = '<div class="chat_con">' +
							'<p class="chat_p">' +
								'<img class="icon_zl" src='+imgSrc+'>' +
								'<span class="uid zl_name" data-id="'+message.uid+'" onclick="reply(this)">'+message.nickname+'</span>' +
								'<span class="sendTime">'+message.sendTime+'</span>' +
							'</p>' ;
					if(message.identity==2){
						html+='<span class="zl_con dis_in">'+message.content+'</span></div>';
					}else {
						html+='<span class="yk_con  dis_in">'+message.content+'</span></div>';
					};
					$("#message").append(html);
					if(message.content.indexOf(uid)!=-1){
						var uid=$("#userId").attr("data-id");
						var nickname=$(".nickname").html();
						var identity=$("#userId").attr("data-type");
						var sendTime=getDate();
						var imgSrc=src(identity);
						var myMessage="<div class='chat_con chat_right chat_right_color'>"+
								"<p class='chat_p'><img class='icon_zl' src='"+imgSrc+"'/><span class='zl_name uid' data-id='"+uid+"'>"+nickname+"</span><span class='sendTime'>"+sendTime+"</span></p>";
						myMessage+='<span class="yk_con yk_r dis_in"><span style="color:red">有人@我</span>'+message.nickname+":"+message.content+'</span></div>';
						$("#message").append(myMessage);
					}
					var _height=$('#message')[0].scrollHeight;
					$(".messageBox").animate({scrollTop:_height+'px'},500);
				}
			};
			if(message.status==4){
				var content=message.content;
				flystart(content);
			}
		};
		$("#content").keydown(function (event) {
			event = event || window.event;
			var keyCode = event.keyCode;
			//根据keycode判断按下的是哪个键
			if(keyCode=='13'){
				sendMessage();
				event.returnValue = false;
				return false;
			}
		});
		$(".userLogin").keydown(function (event) {
			event = event || window.event;
			var keyCode = event.keyCode;
			//根据keycode判断按下的是哪个键
			if(keyCode=='13'){
				userLogin();
				event.returnValue = false;
				return false;
			}
		});
		$("#sendMessage").click(function(){
			sendMessage();
		});
		function sendMessage(){
			var _content = $("#content").html();
			var content = $.trim(_content.replace(/&nbsp;/ig,' ')); // 用jQuery的trim方法删除前后空格
			if(content.length<=0 || content=="<br>"){
				alert("发送内容不能为空！");
				$("#content").html("");
				return;
			}
			var uid=$("#userId").attr("data-id");
			var nickname=$(".nickname").html();
			var identity=$("#userId").attr("data-type");
			var sendTime=getDate();
			console.log(sendTime)
			var imgSrc=src(identity);
			$("#content").html("");
			var status = 0;

			var messageContent = JSON.stringify({"content":content,"status":status,"uid":uid,"nickname":nickname,"identity":identity,"sendTime":sendTime});
			$.ajax({
				url:"http://zbstest.guochengic.com/home/Chat/addChat",
				type:"POST",
				data:{
					content:messageContent
				},
				success: function (res) {
					console.log(res)
					if(res.code==0){
						var message = JSON.stringify({"content":content,"status":0,"uid":uid,"nickname":nickname,"identity":identity,"sendTime":sendTime,"chatId":res.data.chat_id});
						var myContent=JSON.parse(message);
						var myMessage="<div class='chat_con chat_right' data-id='"+res.data.chat_id+"'>"+
								"<p class='chat_p'><img class='icon_zl' src='"+imgSrc+"'/><span class='zl_name uid' data-id='"+uid+"'>"+nickname+"</span><span class='sendTime'>"+sendTime+"</span></p>"+
								"<span class='yk_con yk_r dis_in'>"+myContent.content+"</span>"+
								"</div>";
						ws.send(message);
						$("#message").append(myMessage);
						var _height=$('#message')[0].scrollHeight;
						$(".messageBox").animate({scrollTop:_height+'px'},500);
					}
				}
			});

		};

		function src(data){
			var imgSrc="";
			if(data=="tourist"){
				imgSrc="__PUBLIC__/home/images/icon_yk_big.png";
			}else if(data=="3"){
				imgSrc="__PUBLIC__/home/images/icon_hy.png";
			}else if(data=="1"){
				imgSrc="__PUBLIC__/home/images/icon_zl.png";
			}else if(data=="2"){
				imgSrc="__PUBLIC__/home/images/icon_zl.png";
			}else{
				imgSrc="__PUBLIC__/home/images/icon_yk_big.png";
			}
			return imgSrc;
		};
		function randoms(){
			var random=Math.floor(Math.random()*1000+1);
			console.log("{:captcha_src()}"+"?rand="+random);
			$('#rands').attr("src","{:captcha_src()}"+"?rand="+random);
		};
		//用户登录
		function userLogin(){
			var username=$(".userLogin .mobile").val();
			var password=$(".userLogin .password").val();
			var captcha=$(".userLogin .code").val();
			$.ajax({
				type:"POST",
				url:"http://zbstest.guochengic.com/home/login/login",
				data:{
					"username":username,
					"password":password,
					"captcha":captcha
				},
				success: function (res) {
					if(res.code==0){
						$("#suc").show();
						$("#sucmsg").html(res.msg);
						successHide();
						$(".userLogin").hide();
						$("#userId").attr("data-type",res.data.type);
						save();
						if(res.data.type==2){
							location.href="<?php echo url('index/verify')?>";
						}else {
							location.reload();
						}
					}else {
						$("#error").show();
						$("#errmsg").html(res.msg);
						errorHide();
						return;
					}
				}
			});
		};


		//文件上传
		var flag=true;

		$("#fileId").change(function () {
			if(flag){
				flag=false;
				ajaxFileUpload();
			}

		});


		function fileChange(){
			var imagSize =  document.getElementById("fileId").files[0].size;
			if(imagSize>1024*100){
				alert("图片大小在100kb以内，为："+imagSize/(1024)+"kb");
				location.reload();
				return;
			};
			var imgFile = new FileReader();
			imgFile.readAsDataURL(document.getElementById('fileId').files[0]);
			imgFile.onload = function () {
				var imgData = this.result; //base64数据
				ajaxFileUpload(imgData);
			};
		}
		function ajaxFileUpload() {
			$.ajaxFileUpload
			(
					{
						url: "http://zbstest.guochengic.com/home/upload/upload", //用于文件上传的服务器端请求地址
						secureuri: false, //是否需要安全协议，一般设置为false
						fileElementId: 'fileId', //文件上传域的ID
						dataType:'post',
						success: function (data)  //服务器成功响应处理函数
						{
							flag=true;
							var url = data;
							var content = "<img src='"+url+"'>";
							var uid=$("#userId").attr("data-id");
							var nickname=$(".nickname").html();
							var identity=$("#userId").attr("data-type");
							var sendTime=getDate();
							var imgSrc=src(identity);
							$("#content").html("");
							var message = JSON.stringify({"content":content,"status":0,"uid":uid,"nickname":nickname,"identity":identity,"sendTime":sendTime});
							$.ajax({
								url:"http://zbstest.guochengic.com/home/Chat/addChat",
								type:"POST",
								data:{
									content:message
								},
								success: function (res) {
									console.log(res)
									if(res.code==0){
										var message = JSON.stringify({"content":content,"status":0,"uid":uid,"nickname":nickname,"identity":identity,"sendTime":sendTime,"chatId":res.data.chat_id});
										var myContent=JSON.parse(message);
										var myMessage="<div class='chat_con chat_right' data-id='"+res.data.chat_id+"'>"+
												"<p class='chat_p'><img class='icon_zl' src='"+imgSrc+"'/><span class='zl_name uid' data-id='"+uid+"'>"+nickname+"</span><span class='sendTime'>"+sendTime+"</span></p>"+
												"<span class='yk_con yk_r dis_in'>"+myContent.content+"</span>"+
												"</div>";
										ws.send(message);
										$("#message").append(myMessage);
										var _height=$('#message')[0].scrollHeight;
										$(".messageBox").animate({scrollTop:_height+'px'},500);
									}else {
										$("#errmsg").html(res.msg);
										$("#error").show();
										errorHide();

									}
								}
							});

						}

					}
			)
			return false;
		};
		function lookRecommendSure(){
			var recommendId= $("#content6_integral1").attr("data-id");
			$.ajax({
				url:"http://zbstest.guochengic.com/home/integral/readShare",
				type:"POST",
				data:{
					"shares_id":recommendId
				},
				success: function (res) {
					if(res.code==0){
						$.ajax({
							url:"<?php echo url('index/typeData')?>",
							type:"POST",
							data:{
								"type":2,
								"column_id":2
							},
							success: function (data) {
								console.log(data)
								$("#popup").hide();
								$("#popup").html(data);
								$("#content6").show();
								$("#content6_integral").hide();
								$("#content6_integral1").hide();
								$("#popup").show();
							}
						});
					}else {
						$("#error").show();
						$("#errmsg").html(res.msg);
						errorHide();
						return;
					}
				}
			});
		};

	</script>
</html>